const Koa = require("koa");
const Router = require("koa-router");
const koaviews = require("koa-views");
const koaBody = require("koa-body");
const koastatic = require("koa-static");
let data = require("./data.json");
const app = new Koa();
let router = new Router();
app.use(koaBody());

app.use(koaviews(__dirname+"/views"))
app.use(koastatic(__dirname+"/static"))
router.get('/getdata',ctx=>{
    ctx.body=data
})
router.get('/getgoods',ctx=>{
    ctx.body=data.goods
})
router.get('/getratings',ctx=>{
    ctx.body=data.ratings
})
router.get('/getseller',ctx=>{
    ctx.body=data.seller
})
app.use(router.routes());
app.listen(8585);